document.write('<link type="text/css" rel="stylesheet" href="component/jquery/notify/css/jquery.gritter.css" />');
document.write('<script src="component/jquery/notify/js/jquery.gritter.min.js" type="text/javascript"></script>');
$(function(){
	// global setting override
	$.extend($.gritter.options, {
	    position: 'top-right', // possibilities: bottom-left, bottom-right, top-left, top-right
		fade_in_speed: 300, // how fast notifications fade in (string or int)
		fade_out_speed: 500, // how fast the notices fade out
		time: 3000 // hang on the screen for...
	});
});

function notifyRemoveAll(funcBeforeClose,funcAfterClose){
	$.gritter.removeAll({
		before_close: function(e){
			if(funcBeforeClose)funcBeforeClose();
		},
		after_close: function(){
			if(funcAfterClose)funcAfterClose();
		}
	});
}

function notifyWarn(text){
	notifyCreater(('<span style="color:red">'+text+'</span>'),'<span style="color:red"><b>警告：</b></span>');
}

/**
 * notifyCreater("内容",null,null,true,function(){})
 * @param text
 * @param title
 * @param image
 * @param sticky
 * @param funcBeforeOpen
 * @param funcAfterOpen
 * @param funcBeforeClose
 * @param funcAfterClose
 */
function notifyCreater(text,title,image,sticky,funcBeforeOpen,funcAfterOpen,funcBeforeClose,funcAfterClose){
	$.gritter.add({
		// (string | mandatory) the heading of the notification
		title: (title?title:"提示："),
		// (string | mandatory) the text inside the notification
		text: (text?text:""),
		// (string | optional) the image to display on the left
		image: (image?image:null),
		// (bool | optional) if you want it to fade out on its own or just sit there
		sticky: sticky,
		// (function | optional) function called before it opens
		before_open: function(){
			if(funcBeforeOpen)funcBeforeOpen();
		},
		// (function | optional) function called after it opens
		after_open: function(e){
			if(funcAfterOpen)funcAfterOpen();
		},
		// (function | optional) function called before it closes
		before_close: function(e){
			if(funcBeforeClose)funcBeforeClose();
		},
		// (function | optional) function called after it closes
		after_close: function(){
			if(funcAfterClose)funcAfterClose();
		}
		// You can have it return a unique id, this can be used to manually remove it later using
		/*
		setTimeout(function(){

			$.gritter.remove(unique_id, {
				fade: true,
				speed: 'slow'
			});

		}, 6000)
		*/
	});
}